import { request } from "@/utils/axios";
import { mockUrlPrefix } from "@/api/baseUrl";

// 获取角色菜单
export function getRoleMenus() {
  return request({
    url: `${mockUrlPrefix}/api/role/routes`,
    method: "get",
  });
}

// 获取全部路由信息
export function getAllRoutes() {
  return request({
    url: `${mockUrlPrefix}/api/system/route`,
    method: "get",
  });
}

// 添加路由
export function addRoute(data) {
  return request({
    url: `${mockUrlPrefix}/api/system/route`,
    method: "post",
    data,
  });
}

export function updateRoute(data) {
  return request({
    url: `${mockUrlPrefix}/api/system/route`,
    method: "put",
    data,
  });
}

export function deleteRoute(id) {
  return request({
    url: `${mockUrlPrefix}/api/system/route?id=${id}`,
    method: "delete",
  });
}
